package org.lionsoul.ip2region2;

public class Util
{
  public static void write(byte[] paramArrayOfByte, int paramInt1, long paramLong, int paramInt2)
  {
    for (int i = 0; i < paramInt2; i++)
      paramArrayOfByte[(paramInt1++)] = ((byte)(int)(paramLong >>> 8 * i & 0xFF));
  }

  public static void writeIntLong(byte[] paramArrayOfByte, int paramInt, long paramLong)
  {
    paramArrayOfByte[(paramInt++)] = ((byte)(int)(paramLong >> 0 & 0xFF));
    paramArrayOfByte[(paramInt++)] = ((byte)(int)(paramLong >> 8 & 0xFF));
    paramArrayOfByte[(paramInt++)] = ((byte)(int)(paramLong >> 16 & 0xFF));
    paramArrayOfByte[paramInt] = ((byte)(int)(paramLong >> 24 & 0xFF));
  }

  public static long getIntLong(byte[] paramArrayOfByte, int paramInt)
  {
    return paramArrayOfByte[(paramInt++)] & 0xFF | paramArrayOfByte[(paramInt++)] << 8 & 0xFF00 | paramArrayOfByte[(paramInt++)] << 16 & 0xFF0000 | paramArrayOfByte[paramInt] << 24 & 0xFF000000;
  }

  public static int getInt3(byte[] paramArrayOfByte, int paramInt)
  {
    return paramArrayOfByte[(paramInt++)] & 0xFF | paramArrayOfByte[(paramInt++)] & 0xFF00 | paramArrayOfByte[paramInt] & 0xFF0000;
  }

  public static int getInt2(byte[] paramArrayOfByte, int paramInt)
  {
    return paramArrayOfByte[(paramInt++)] & 0xFF | paramArrayOfByte[paramInt] & 0xFF00;
  }

  public static int getInt1(byte[] paramArrayOfByte, int paramInt)
  {
    return paramArrayOfByte[paramInt] & 0xFF;
  }

  public static long ip2long(String paramString)
  {
    String[] arrayOfString = paramString.split("\\.");
    if (arrayOfString.length != 4)
      return 0L;
    int i = Integer.valueOf(arrayOfString[0]).intValue() << 24 & 0xFF000000;
    int j = Integer.valueOf(arrayOfString[1]).intValue() << 16 & 0xFF0000;
    int k = Integer.valueOf(arrayOfString[2]).intValue() << 8 & 0xFF00;
    int m = Integer.valueOf(arrayOfString[3]).intValue() << 0 & 0xFF;
    return (i | j | k | m) & 0xFFFFFFFF;
  }

  public static String long2ip(long paramLong)
  {
    StringBuilder localStringBuilder = new StringBuilder();
    localStringBuilder.append(paramLong >> 24 & 0xFF).append('.').append(paramLong >> 16 & 0xFF).append('.').append(paramLong >> 8 & 0xFF).append('.').append(paramLong >> 0 & 0xFF);
    return localStringBuilder.toString();
  }

  public static boolean isIpAddress(String paramString)
  {
    String[] arrayOfString1 = paramString.split("\\.");
    if (arrayOfString1.length != 4)
      return false;
    for (String str : arrayOfString1)
    {
      if (str.length() > 3)
        return false;
      int k = Integer.valueOf(str).intValue();
      if (k > 255)
        return false;
    }
    return true;
  }
}

/* Location:           C:\Users\zhangliang.sm\Desktop\dbMaker-1.2.2.jar
 * Qualified Name:     org.lionsoul.ip2region.Util
 * JD-Core Version:    0.6.2
 */